2013-08-08 build Vyatta 6.6 from source
Updated to build open-vm-tools.
This document describes one mechanism to build a bootable Vyatta i386 iso from the Vyatta source code repository (branch daisy = version 6.6). It is based on the README file in the Vyatta git tree, with some errors corrected. Note that most of the version numbers here are tied to that branch (daisy) and architecture (i386).
Starting with a Fedora 19 workstation, install the virtualization package and tools.
yum -y install @virtualization yum -y install libguestfs-tools systemctl stop libvirtd systemctl start libvirtd virsh net-list --all virt-manager
Download debian-6.0.7-i386-netinst.iso (md5sum is 6ebdb31269a3eaaf72fca0ed2f6ba29b) from http://www.debian.org/releases/squeeze/debian-installer/. Use that in virt-manager to create a VM.
type linux, version debian squeeze 2G memory, 20G disk advanced, type KVM, arch i686 graphic install install std system utilities, and ssh server
Copy the bash script below to your new debian vyatta build machine, and run:
bash build.vyatta-6.6 phase1 bash build.vyatta-6.6 phase2 bash build.vyatta-6.6 phase3
The bootable iso will be created in 'vyatta/build-iso/livecd/binary.iso'.
build.vyatta-6.6
#!/bin/bash function logger() { d=$(date) echo " " echo "*** $d $1" } function install-vyatta-unstable() { echo "" >packages for p in $PKGS; do wget http://packages.vyatta.com/vyatta-dev/$branch/unstable/pool/main/$p echo $p >>packages done dpkg -i $(cat packages) } function install-local-rebuilds() { echo "" >packages for p in $PKGS; do pp="build-iso/pkgs/$p" echo $pp >>packages done dpkg -i $(cat packages) } function install-lenny() { echo "" >packages for p in $PKGS; do wget http://packages.vyatta.com/debian/pool/main/$p pp=$(basename $p) echo $pp >>packages done dpkg -i $(cat packages) } function phase1() { logger "phase 1 - add debian packages and vyatta source tree needed" echo "to build vyatta from source, branch $branch in $(pwd)" echo "current system $(uname -a)" echo "this should be a new debian squeeze installation" logger "install debian squeeze packages needed for building vyatta" apt-get -y install ssh build-essential sudo bzip2 curl autoconf git devscripts \ debhelper autotools-dev automake libtool bison flex lintian \ libglib2.0-dev libapt-pkg-dev libboost-filesystem1.42-dev \ libncurses5-dev libdb-dev libssl-dev cdbs libmozjs-dev \ libreadline5-dev libpam0g-dev libcap-dev libsnmp-dev gawk unzip \ kernel-package libatm1-dev git-buildpackage libnfnetlink-dev \ libnetfilter-conntrack-dev libattr1-dev rsync libxml2-dev \ libedit-dev libpcap0.8-dev libpci-dev lsb-release quilt ruby \ genisoimage liblzo2-dev unifont libpopt-dev libgmp3-dev \ libcurl4-openssl-dev libopensc2-dev libldap2-dev libkrb5-dev \ hardening-wrapper libgcrypt11-dev libpcre3-dev libprelude-dev \ libgnutls-dev libperl-dev python-all-dev python-setuptools \ live-helper syslinux libsort-versions-perl libexpat1-dev \ libfile-sync-perl gcc-multilib libfreetype6-dev libusb-dev \ libdevmapper-dev libmysqlclient-dev autogen libdumbnet-dev logger "install the vyatta package key" wget http://packages.vyatta.com/vyatta-dev/vyatta-pubkey.gpg apt-key add vyatta-pubkey.gpg logger "install squashfs tools" PKGS="squashfs-tools_4.1+vyatta-9+daisy1_i386.deb" install-vyatta-unstable logger "pin squash tools version" cat >/etc/apt/preferences.d/squashfs-tools <<EOF Package: squashfs-tools Pin: version 4.* Pin-Priority: 1001 EOF logger "install more vyatta packages" PKGS="libmnl0_1.0.3-5+daisy1_i386.deb libmnl-dev_1.0.3-5+daisy1_i386.deb libnetfilter-conntrack3_1.0.0-1+vyatta16+daisy2_i386.deb libnetfilter-conntrack-dev_1.0.0-1+vyatta16+daisy2_i386.deb " install-vyatta-unstable logger "clone git repository" git clone http://git.vyatta.com/build-iso.git (cd build-iso; git checkout --track -b $branch origin/$branch) logger "we could build an initial iso here" #( # cd build-iso # export PATH=/sbin:/usr/sbin:$PATH # autoreconf -i # ./configure # make iso #) logger "setup for building subpackages" logger "lenny packages directly from vyatta" PKGS="libn/libnet0/libnet0-dev_1.0.2a-7_i386.deb libn/libnet0/libnet0_1.0.2a-7_i386.deb s/sablotron/libsablot0-dev_1.0.3-1_i386.deb s/sablotron/libsablot0_1.0.3-1_i386.deb " install-lenny logger "documentation issues" echo "README says we need some libmnl packages from wheezy," echo "but $branch packages are newer and installed above" echo "later, tools/submod-mk tries to build libczmq, which" echo "needs newer packages from wheezy. Eventually, that" echo "needs multiarch which needs a newer libc. I dropped" echo "that, since the vyatta repo only has amd64 packages" echo "for libczmq, implying we don't need to build that for i686" logger "add packages documented in README, but libdaq is not in $branch" PKGS="iptables_1.4.10+vyatta+6+daisy1_i386.deb iptables-dev_1.4.10+vyatta+6+daisy1_i386.deb linux-vyatta-kbuild_3.3.8-1+vyatta+14+daisy9_i386.deb libsnmp15_5.7.2-vyatta+1+daisy4_i386.deb libsnmp-dev_5.7.2-vyatta+1+daisy4_i386.deb libsnmp-perl_5.7.2-vyatta+1+daisy4_i386.deb libsnmp-base_5.7.2-vyatta+1+daisy4_all.deb libcap-dev_2.19-3+vyatta4+daisy1_i386.deb libcap2_2.19-3+vyatta4+daisy1_i386.deb libvyatta-cfg-dev_0.101.7+daisy11_i386.deb libvyatta-cfg1_0.101.7+daisy11_i386.deb " # others that are needed to build, but not mentioned in README PKGS="$PKGS libnetfilter-cttimeout_1.0.0-3+daisy1_i386.deb libnetfilter-cthelper_1.0.1-4+daisy1_i386.deb libnetfilter-queue-dev_0.0.17-6+daisy1_i386.deb libnetfilter-queue1_0.0.17-6+daisy1_i386.deb " install-vyatta-unstable logger "pin libcap versions" cat >/etc/apt/preferences.d/libcap-dev <<EOF Package: libcap-dev Pin: version 2.* Pin-Priority: 1001 EOF cat >/etc/apt/preferences.d/libcap2 <<EOF Package: libcap2 Pin: version 2.* Pin-Priority: 1001 EOF logger "checkout all the submodules" ( cd build-iso git submodule init git submodule update for i in pkgs/*; do if [ -d "$i/.git" ]; then pushd "$i" git checkout --track -b $branch origin/$branch popd fi done ) logger "install undocumented package needed to build libcap" apt-get -y install indent logger "install undocumented package needed to build ntp" apt-get -y install lynx logger "install undocumented package needed to build open-vm-tools" apt-get -y install libproc-dev logger "install undocumented package needed to build vyatta-quagga" apt-get -y install libreadline-dev } function phase2() { logger "phase 2 - fetch source from vyatta" ( cd build-iso export PATH=/sbin:/usr/sbin:$PATH logger "update all the source from vyatta" git pull git submodule init tools/submod-git pull ( logger "linux-image missing debian/control file" cd pkgs/linux-image debian/rules debian/control ) ( logger "open-vm-tools missing config/guess file" cd pkgs/open-vm-tools automake --add-missing ) ) } function phase3() { logger "phase 3 - build new iso from source" ( cd build-iso export PATH=/sbin:/usr/sbin:$PATH logger "cleanup all the subpackages" tools/submod-clean -d # rebuild all pkgs from source # we manually run submod-mk for each package, since even # on i686, it still tries to build libczmq logger "build all subpackages" for i in pkgs/*; do p=$(basename $i) if [ -d $i/.git ] && [ "$p" != "libczmq" ] ; then logger "building source package $p" tools/submod-mk $p fi done logger "build the new iso" autoreconf -i ./configure make iso logger "done, iso in vyatta/build-iso/livecd" ls -al livecd ) } function phase4() { logger "phase4 - install newly built $branch packages to replace" echo "those installed from the vyatta repository" PKGS="squashfs-tools_4.1+vyatta-9+daisy1_i386.deb libmnl0_1.0.3-5+daisy1_i386.deb libmnl-dev_1.0.3-5+daisy1_i386.deb libnetfilter-conntrack3_1.0.0-1+vyatta16+daisy2_i386.deb libnetfilter-conntrack-dev_1.0.0-1+vyatta16+daisy2_i386.deb iptables_1.4.10+vyatta+6+daisy1_i386.deb iptables-dev_1.4.10+vyatta+6+daisy1_i386.deb linux-vyatta-kbuild_3.3.8-1+vyatta+14+daisy8_i386.deb libsnmp15_5.7.2-vyatta+1+daisy4_i386.deb libsnmp-dev_5.7.2-vyatta+1+daisy4_i386.deb libsnmp-base_5.7.2-vyatta+1+daisy4_all.deb libsnmp-perl_5.7.2-vyatta+1+daisy4_i386.deb libcap-dev_2.19-3+vyatta4+daisy1_i386.deb libcap2_2.19-3+vyatta4+daisy1_i386.deb libvyatta-cfg1_0.101.7+daisy5_i386.deb libvyatta-cfg-dev_0.101.7+daisy5_i386.deb libnetfilter-cttimeout_1.0.0-3+daisy1_i386.deb libnetfilter-cthelper_1.0.1-4+daisy1_i386.deb libnetfilter-queue-dev_0.0.17-6+daisy1_i386.deb libnetfilter-queue1_0.0.17-6+daisy1_i386.deb " install-local-rebuilds } branch=daisy [ ! -d vyatta ] && mkdir vyatta cd vyatta case "$1" in phase*) "$1" >../"$1".log 2>&1 cd .. ls -al "$1".log ;; *) echo unknown arg $1 ;; esac
errors in Vyatta README
The procedure above was derived from the official Vyatta procedure documented in their README file. However, for branch daisy (version 6.6) there are a number of errors in their documentation, such that it won't actually build properly.
- README (line 27) should mention that we need to install more
packages from Debian via apt-get.
- indent is need to build libcap
- lynx is need to build ntp
- libproc-dev is need to build open-vm-tools
- libreadline-dev is need to build vyatta-quagga
- README (line 72) says we need some libmnl packages from wheezy, but branch daisy packages are newer, so I used those.
- README (line 145) says we need libdaq from vyatta unstable, but it is not available in the vyatta unstable daisy repository. I ignored that. Also at this point, README should mention we also need libnetfilter-cttimeout, libnetfilter-cthelper, libnetfilter-queue-dev, libnetfilter-queue1 packages.
- README (line 192) should mention that if you are working on the linux-image submodule, you need to "(cd pkgs/linux-image; debian/rules debian/control)" to create the missing debian/control file.
- README (line 192) should mention that if you are working on the open-vm-tools submodule, you need to "(cd pkgs/open-vm-tools; automake --add-missing)" to create the missing config/guess file.
- README (line 238) tools/submod-mk does not accept --all parameter. It builds all the modules if there are no arguments. However, there is a bug (at least on the i386 build). tools/submod-mk tries to build the libczmq subpackage, but that seems to only be available on the x86-64 architecture. I could never get that to build on i386, and the vyatta unstable daisy repository only has the x86-64 version as well. So we cannot let tools/submod-mk build everything, but instead need to do our own loop to build only some modules.